package count.negative.devau;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import count.negative.devau.service.ProgramService;
import count.negative.devau.service.RtvService;

public class DevauActivity extends Activity {
	public ProgramService ps;
	public WebView webview;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ps = new RtvService(getApplication(), this);

		webview = new WebView(this);
		webview.setPadding(0, 0, 0, 0);
		webview.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
		setContentView(webview);
		final String html = ps.getHTML();
		if (html != null) {
			webview.loadDataWithBaseURL(ps.getBaseURL(), html, "text/html"/*; charset=UTF-8"*/, "UTF-8", ps.getBaseURL());
		}
		webview.setClickable(true);
		//		webview.getSettings().setBlockNetworkImage(true); // gar keine Bilder runterladen
		webview.getSettings().setGeolocationEnabled(false);
		webview.getSettings().setDefaultTextEncodingName("utf-8");
		webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
		webview.getSettings().setJavaScriptEnabled(false);

		WebViewClient webViewClient = new TvWebViewClient(ps);
		webview.setWebViewClient(webViewClient);
	}

	//	@Override
	//	public boolean onKeyDown(int keyCode, KeyEvent event) {
	//		if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
	//			webview.goBack();
	//			return true;
	//		}
	//		return super.onKeyDown(keyCode, event);
	//	}
}